options ls = 100 ps = 80 probsig=2;

data fuzzy1;  informat code $25.;informat bcode $20.;
   infile 'c:/My Documents/data/scAT.3/ASDoneIAT_exp3a.dat' delimiter='09'x;
   input date    time  $  build  sub   code    $   block   trial  lat     resp  $  corr  trialitm    bcode $;
data fuzzy2;  informat code $25.;informat bcode $20.;
   infile 'c:/My Documents/data/scAT.3/ASDoneIAT_exp3b.dat' delimiter='09'x;
   input date    time  $  build  sub   code    $   block   trial  lat     resp  $  corr  trialitm    bcode $;
data fuzzy3;  informat code $25.;informat bcode $20.;
   infile 'c:/My Documents/data/scAT.3/BSDoneIAT_exp3a.dat' delimiter='09'x;
   input date    time  $  build  sub   code    $   block   trial  lat     resp  $  corr  trialitm    bcode $;
data fuzzy4;  informat code $25.;informat bcode $20.;
   infile 'c:/My Documents/data/scAT.3/BSDoneIAT_exp3b.dat' delimiter='09'x;
   input date    time  $  build  sub   code    $   block   trial  lat     resp  $  corr  trialitm    bcode $;
data fuzzy5;  informat code $25.;informat bcode $20.;
   infile 'c:/My Documents/data/scAT.3/ESDoneIAT_exp3a.dat' delimiter='09'x;
   input date    time  $  build  sub   code    $   block   trial  lat     resp  $  corr  trialitm    bcode $;
data fuzzy6;  informat code $25.;informat bcode $20.;
   infile 'c:/My Documents/data/scAT.3/CSDoneIAT_exp3b.dat' delimiter='09'x;
   input date    time  $  build  sub   code    $   block   trial  lat     resp  $  corr  trialitm    bcode $;
data fuzzy7;  informat code $25.;informat bcode $20.;
   infile 'c:/My Documents/data/scAT.3/FSDoneIAT_exp3a.dat' delimiter='09'x;
   input date    time  $  build  sub   code    $   block   trial  lat     resp  $  corr  trialitm    bcode $;
data fuzzy8;  informat code $25.;informat bcode $20.;
   infile 'c:/My Documents/data/scAT.3/CSDoneIAT_exp3a.dat' delimiter='09'x;
   input date    time  $  build  sub   code    $   block   trial  lat     resp  $  corr  trialitm    bcode $;
data fuzzy9;  informat code $25.;informat bcode $20.;
   infile 'c:/My Documents/data/scAT.3/GSDoneIAT_exp3a.dat' delimiter='09'x;
   input date    time  $  build  sub   code    $   block   trial  lat     resp  $  corr  trialitm    bcode $;
data fuzzy10;  informat code $25.;informat bcode $20.;
   infile 'c:/My Documents/data/scAT.3/GSDoneIAT_exp3b.dat' delimiter='09'x;
   input date    time  $  build  sub   code    $   block   trial  lat     resp  $  corr  trialitm    bcode $;
data fuzzy11;  informat code $25.;informat bcode $20.;
   infile 'c:/My Documents/data/scAT.3/C2SDoneIAT_exp3b.dat' delimiter='09'x;
   input date    time  $  build  sub   code    $   block   trial  lat     resp  $  corr  trialitm    bcode $;
data temp;
  set fuzzy1 fuzzy2 fuzzy3 fuzzy5 fuzzy6 fuzzy7 fuzzy8 fuzzy9 fuzzy10 fuzzy11;

if block in (1,2) then delete;if trial < 19 then delete;if bcode = 'bcode' then delete;

if code in ( 'bugs_false833', 'fruit_false833', 'good_false833', 'bad_false833',
             'bugbackground_false833', 'fruitbackground_false833'
             'bugs_false666', 'fruit_false666', 'good_false666', 'bad_false666',
             'bugbackground_false666', 'fruitbackground_false666')
then item = 0;else item = 1;

if corr = 0 and item = 0 then response = 'corrrej'; if corr = 0 and item = 1 then response = 'miss';
if corr = 1 and item = 0 then response = 'falsalr'; if corr = 1 and item = 1 then response = 'hit';

/*proc means n mean std; class category code response; var lat; run;*/

proc sort; by sub bcode response; run;
proc means noprint data=temp n; by sub bcode response; var lat; output out=means  mean=speed; run;
proc transpose data=means prefix=speed name=name out=spdmeans; by sub bcode response;run;
proc sort; by name; run;
data prac;  set spdmeans; if name ^= '_FREQ_' then delete;
   /*if speed1 < 0 then speed1 = 0;*/
   if response = 'corrrej' then do;
      if speed1 = 18 then do; response = 'falsalr'; speed1 = 0.4; end;
      else delete; end;
   if response = 'miss' then do;
      if speed1 = 24 then do; response = 'hit'; speed1 = 0.4; end;
      else delete; end;
   if response = 'hit' and speed1 = 24 then speed1 = 23.6;
   if response = 'falsalr' and speed1 = 18 then speed1 = 17.6;
proc sort; by sub;
proc transpose data=prac prefix=freq name=name out=freq;
  by sub; run;
proc sort; by name; run;
data prac; set freq;
   pbbgbd66 = freq1/18; pbHbgbd6 = 1-freq2/24;
   pbbgbd83 = freq3/18; pbHbgbd8 = 1-freq4/24;
   pbbggd66 = freq5/18; pbHbggd6 = 1-freq6/24;
   pbbggd83 = freq7/18; pbHbggd8 = 1-freq8/24;
   pbftbd66 = freq9/18; pbHftbd6 = 1-freq10/24;
   pbftbd83 = freq11/18; pbHftbd8 = 1-freq12/24;
   pbftgd66 = freq13/18; pbHftgd6 = 1-freq14/24;
   pbftgd83 = freq15/18; pbHftgd8 = 1-freq16/24;
   pnbgbd66 = freq17/18; pnHbgbd6 = 1-freq18/24;
   pnbgbd83 = freq19/18; pnHbgbd8 = 1-freq20/24;
   pnbggd66 = freq21/18; pnHbggd6 = 1-freq22/24;
   pnbggd83 = freq23/18; pnHbggd8 = 1-freq24/24;
   pnftbd66 = freq25/18; pnHftbd6 = 1-freq26/24;
   pnftbd83 = freq27/18; pnHftbd8 = 1-freq28/24;
   pnftgd66 = freq29/18; pnHftgd6 = 1-freq30/24;
   pnftgd83 = freq31/18; pnHftgd8 = 1-freq32/24;

   pb666 = mean(pbbgbd66, pbHbgbd6, pbbggd66, pbHbggd6, pbftbd66, pbHftbd6, pbftgd66, pbHftgd6);
   pb833 = mean(pbbgbd83, pbHbgbd8, pbbggd83, pbHbggd8, pbftbd83, pbHftbd8, pbftgd83, pbHftgd8);
   pn666 = mean(pnbgbd66, pnHbgbd6, pnbggd66, pnHbggd6, pnftbd66, pnHftbd6, pnftgd66, pnHftgd6);
   pn833 = mean(pnbgbd83, pnHbgbd8, pnbggd83, pnHbggd8, pnftbd83, pnHftbd8, pnftgd83, pnHftgd8);

   ybbgbd66 = (freq1+freq2)/42;  ybbgbd83 = (freq3+freq4)/42; 
   ybbggd66 = (freq5+freq6)/42;  ybbggd83 = (freq7+freq8)/42; 
   ybftbd66 = (freq9+freq10)/42;  ybbggd83 = (freq11+freq12)/42; 
   ybftgd66 = (freq13+freq14)/42;  ybbggd83 = (freq15+freq16)/42; 
   ynftbd66 = (freq17+freq18)/42;  ynftbd83 = (freq19+freq20)/42; 
   ynftbd66 = (freq21+freq22)/42;  ynftbd83 = (freq23+freq24)/42; 
   ynftgd66 = (freq25+freq26)/42;  ynftgd83 = (freq27+freq28)/42; 
   ynftgd66 = (freq29+freq30)/42; ynftgd83 = (freq31+freq32)/42; 

   BFbgbd66 = probit(freq1/18); BHbgbd66 = probit(freq2/24);
   BFbgbd83 = probit(freq3/18); BHbgbd83 = probit(freq4/24);
   BFbggd66 = probit(freq5/18); BHbggd66 = probit(freq6/24);
   BFbggd83 = probit(freq7/18); BHbggd83 = probit(freq8/24);
   BFftbd66 = probit(freq9/18); BHftbd66 = probit(freq10/24);
   BFftbd83 = probit(freq11/18); BHftbd83 = probit(freq12/24);
   BFftgd66 = probit(freq13/18); BHftgd66 = probit(freq14/24);
   BFftgd83 = probit(freq15/18); BHftgd83 = probit(freq16/24);
   NFbgbd66 = probit(freq17/18); NHbgbd66 = probit(freq18/24);
   NFbgbd83 = probit(freq19/18); NHbgbd83 = probit(freq20/24);
   NFbggd66 = probit(freq21/18); NHbggd66 = probit(freq22/24);
   NFbggd83 = probit(freq23/18); NHbggd83 = probit(freq24/24);
   NFftbd66 = probit(freq25/18); NHftbd66 = probit(freq26/24);
   NFftbd83 = probit(freq27/18); NHftbd83 = probit(freq28/24);
   NFftgd66 = probit(freq29/18); NHftgd66 = probit(freq30/24);
   NFftgd83 = probit(freq31/18); NHftgd83 = probit(freq32/24);
   NDbgbd66 = NHbgbd66 - NFbgbd66; NDbggd66 = NHbggd66 - NFbggd66;
   NDftbd66 = NHftbd66 - NFftbd66; NDftgd66 = NHftgd66 - NFftgd66;
   NDbgbd83 = NHbgbd83 - NFbgbd83; NDbggd83 = NHbggd83 - NFbggd83;
   NDftbd83 = NHftbd83 - NFftbd83; NDftgd83 = NHftgd83 - NFftgd83;
   BDbgbd66 = BHbgbd66 - BFbgbd66; BDbggd66 = BHbggd66 - BFbggd66;
   BDftbd66 = BHftbd66 - BFftbd66; BDftgd66 = BHftgd66 - BFftgd66;
   BDbgbd83 = BHbgbd83 - BFbgbd83; BDbggd83 = BHbggd83 - BFbggd83;
   BDftbd83 = BHftbd83 - BFftbd83; BDftgd83 = BHftgd83 - BFftgd83;
   NBugAt66 = NDbggd66 - NDbgbd66; NFrtAt66 = NDftgd66 - NDftbd66;
   NBugAt83 = NDbggd83 - NDbgbd83; NFrtAt83 = NDftgd83 - NDftbd83;
   BBugAt66 = BDbggd66 - BDbgbd66; BFrtAt66 = BDftgd66 - BDftbd66;
   BBugAt83 = BDbggd83 - BDbgbd83; BFrtAt83 = BDftgd83 - BDftbd83;
   if mod(sub,2) = 1 then order = 1; else order = 0;

   BFbgbdal = probit((freq1+freq3)/36);  BHbgbdal = probit((freq2+freq4)/48);
   BFbggdal = probit((freq5+freq7)/36);  BHbggdal = probit((freq6+freq8)/48);
   BFftbdal = probit((freq9+freq11)/36); BHftbdal = probit((freq10+freq12)/48);
   BFftgdal = probit((freq13+freq15)/36); BHftgdal = probit((freq14+freq16)/48);
   nFbgbdal = probit((freq17+freq19)/36);  nHbgbdal = probit((freq18+freq20)/48);
   nFbggdal = probit((freq21+freq23)/36);  nHbggdal = probit((freq22+freq24)/48);
   nFftbdal = probit((freq25+freq27)/36); nHftbdal = probit((freq26+freq28)/48);
   nFftgdal = probit((freq29+freq31)/36); nHftgdal = probit((freq30+freq32)/48);
   bDbgbdal = bHbgbdal - bFbgbdal;   bDbggdal = bHbggdal - bFbggdal;
   bDftbdal = bHftbdal - bFftbdal;   bDftgdal = bHftgdal - bFftgdal;
   bFruitAl = bDftgdal - bDftbdal;   bBugsAl = bDbggdal - bDbgbdal;
   nDbgbdal = nHbgbdal - nFbgbdal;   nDbggdal = nHbggdal - nFbggdal;
   nDftbdal = nHftbdal - nFftbdal;   nDftgdal = nHftgdal - nFftgdal;
   nFruitAl = nDftgdal - nDftbdal;   nBugsAl = nDbggdal - nDbgbdal;

   bZbgbd83 = probit(1 - freq1/18); bZbgbd66 = probit(1 - freq3/18);
   nZbgbd83 = probit(1 - freq17/18); nZbgbd66 = probit(1 - freq19/18);
   bZbggd83 = probit(1 - freq5/18); bZbggd66 = probit(1 - freq7/18);
   nZbggd83 = probit(1 - freq21/18); nZbggd66 = probit(1 - freq23/18);
   bZftbd83 = probit(1 - freq9/18); bZftbd66 = probit(1 - freq11/18);
   nZftbd83 = probit(1 - freq25/18); nZftbd66 = probit(1 - freq27/18);
   bZftgd83 = probit(1 - freq13/18); bZftgd66 = probit(1 - freq15/18);
   nZftgd83 = probit(1 - freq29/18); nZftgd66 = probit(1 - freq31/18);

   bZbgbdAl = probit(1 - ((freq1+freq3)/36)); bZbggdal = probit(1 - ((freq5+freq7)/36));
   bZftbdal = probit(1 - ((freq9+freq11)/36)); bZftgdal = probit(1 - ((freq13+freq15)/36));
   nZbgbdAl = probit(1 - ((freq17+freq19)/36)); nZbggdal = probit(1 - ((freq21+freq23)/36));
   nZftbdal = probit(1 - ((freq25+freq27)/36)); nZftgdal = probit(1 - ((freq29+freq31)/36));

   bBbgbd83 = probnorm(bZbgbd83 - bDbgbd83)/probnorm(bZbgbd83);
   nBbgbd83 = probnorm(nZbgbd83 - nDbgbd83)/probnorm(nZbgbd83);
   bBbgbd66 = probnorm(bZbgbd66 - bDbgbd66)/probnorm(bZbgbd66);
   nBbgbd66 = probnorm(nZbgbd66 - nDbgbd66)/probnorm(nZbgbd66);
   bBbggd83 = probnorm(bZbggd83 - bDbggd83)/probnorm(bZbggd83);
   nBbggd83 = probnorm(nZbggd83 - nDbggd83)/probnorm(nZbggd83);
   bBbggd66 = probnorm(bZbggd66 - bDbggd66)/probnorm(bZbggd66);
   nBbggd66 = probnorm(nZbggd66 - nDbggd66)/probnorm(nZbggd66);
   bBftbd83 = probnorm(bZftbd83 - bDftbd83)/probnorm(bZftbd83);
   nBftbd83 = probnorm(nZftbd83 - nDftbd83)/probnorm(nZftbd83);
   bBftbd66 = probnorm(bZftbd66 - bDftbd66)/probnorm(bZftbd66);
   nBftbd66 = probnorm(nZftbd66 - nDftbd66)/probnorm(nZftbd66);
   bBftgd83 = probnorm(bZftgd83 - bDftgd83)/probnorm(bZftgd83);
   nBftgd83 = probnorm(nZftgd83 - nDftgd83)/probnorm(nZftgd83);
   bBftgd66 = probnorm(bZftgd66 - bDftgd66)/probnorm(bZftgd66);
   nBftgd66 = probnorm(nZftgd66 - nDftgd66)/probnorm(nZftgd66);

   bBbgbdal = probnorm(bZbgbdal - bDbgbdal)/probnorm(bZbgbdal);
   bBbggdal = probnorm(bZbggdal - bDbggdal)/probnorm(bZbggdal);
   bBftbdal = probnorm(bZftbdal - bDftbdal)/probnorm(bZftbdal);
   bBftgdal = probnorm(bZftgdal - bDftgdal)/probnorm(bZftgdal);
   nBbgbdal = probnorm(nZbgbdal - nDbgbdal)/probnorm(nZbgbdal);
   nBbggdal = probnorm(nZbggdal - nDbggdal)/probnorm(nZbggdal);
   nBftbdal = probnorm(nZftbdal - nDftbdal)/probnorm(nZftbdal);
   nBftgdal = probnorm(nZftgdal - nDftgdal)/probnorm(nZftgdal);

 /*  proc means; var pbbgbd66 pbHbgbd6 pbbgbd83 pbHbgbd8 pbbggd66 pbHbggd6
   pbbggd83 pbHbggd8 pbftbd66 pbHftbd6 pbftbd83 pbHftbd8 pbftgd66 pbHftgd6
   pbftgd83 pbHftgd8 pnbgbd66 pnHbgbd6 pnbgbd83 pnHbgbd8 pnbggd66 pnHbggd6
   pnbggd83 pnHbggd8 pnftbd66 pnHftbd6 pnftbd83 pnHftbd8 pnftgd66 pnHftgd6 pnftgd83 pnHftgd8;run;
   proc means; var pb666 pb833 pn666 pn833;run;
   proc means; var ybbgbd66  ybbgbd83 ybbggd66  ybbggd83 ybftbd66  ybbggd83 ybftgd66  ybbggd83 
   ynftbd66  ynftbd83 ynftbd66  ynftbd83  ynftgd66  ynftgd83  ynftgd66  ynftgd83; run;*/

proc sort data=prac; by sub; run;
data explicit;
  informat major $25.; informat dept $25.;informat Afavrte $25.;informat ethnicit $25.;
  infile 'c:/My Documents/data/math.undergrad.2/math.ugrad.txt' delimiter='09'x;
  input #1 sub Amath Apsych Aengr Aarts Abiology Areading Ascience Aenglish
            Aphysics Aphil AR1 $ AR2 $ AR3 $ AR4 $ AR5 $ AR6 $ AR7 $ AR8 $ AR9 $ AR10 $
            Afavrte $ imath ipsych iengr iarts ibiology ireading iscience ienglish
            iphysics iphil iR1 $ iR2 $ iR3 $ iR4 $ iR5 $ iR6 $ iR7 $ iR8 $ iR9 $ iR10 $
            ifavrte $
        #2  BSRI1 BSRI2 BSRI3 BSRI4 BSRI5 BSRI6 BSRI7 BSRI8 BSRI9 BSRI10
            BSRI11 BSRI12 BSRI13 BSRI14 BSRI15 BSRI16 BSRI17 BSRI18 BSRI19 BSRI20
            BSRI21 BSRI22 BSRI23 BSRI24 BSRI25 BSRI26 BSRI27 BSRI28 BSRI29 BSRI30
            BSRI31 BSRI32 BSRI33 BSRI34 BSRI35 BSRI36 BSRI37 BSRI38 BSRI39 BSRI40
            BSRI41 BSRI42 BSRI43 BSRI44 BSRI45 BSRI46 BSRI47 BSRI48 BSRI49 BSRI50
            BSRI51 BSRI52 BSRI53 BSRI54 BSRI55 BSRI56 BSRI57 BSRI58 BSRI59 BSRI60
            GID1 GID2 GID3 GID4 GID5 GID6 GID7 GID8 GID9 GID10 GID11 GID12 GID13 GID14
        #3  carid1 carid2 carid3 carid4 carid5 carid6 carid7 carid8 carid9 carid10
            carid11 carid12 carid13 IMPgendr IMPage IMPrace IMPses
            bugtemp anmltemp fruttemp foodtemp relfruit relbugs bugfruit
            year dept $ maj $ major age sex $ ethnicit $ bornUS UShwlng Engfirst Enghwlng
            glasses handed $ sleep alert computer SATmath SATverb;

proc sort data=explicit;by sub;run;
data comb;merge prac (in=frog) explicit;by sub;if frog;
data comb;set comb;
  GID2 = 8-GID2; GID4 = 8-GID4; GID5 = 8-GID5; GID7 = 8-GID7; GID9 = 8-GID9; GID11 = 8-GID11;
  GID13 = 8-GID13;
  EsexID = mean (of GID1 GID2 GID4 GID5 GID6 GID8 GID9 GID11 GID12 GID14);
  EothsxID = mean (of GID3 GID7 GID10 GID13);
  careerID = mean (of carid1 carid2 carid4 carid6 carid7 carid9);
  Estereo = mean (of carid3 carid5 carid8 carid10);
  Gendiff = carid11; GenAfct = carid12; Effort = carid13;
  masculin = mean (of BSRI1 BSRI4 BSRI7 BSRI10
            BSRI13 BSRI16 BSRI19 BSRI22 BSRI25 BSRI28 BSRI31 BSRI34 BSRI37 BSRI40
            BSRI43 BSRI46 BSRI49 BSRI52 BSRI55 BSRI58);
  feminine = mean (of BSRI2 BSRI5 BSRI8 BSRI11 BSRI14 BSRI17 BSRI20
            BSRI23 BSRI26 BSRI29 BSRI32 BSRI35 BSRI38 BSRI41 BSRI44 BSRI47 BSRI50
            BSRI53 BSRI56 BSRI59);
  neutral  = mean (of BSRI3 BSRI6 BSRI9 BSRI12 BSRI15 BSRI18 BSRI21 BSRI24 BSRI27 BSRI30
            BSRI33 BSRI36 BSRI39 BSRI42 BSRI45 BSRI48 BSRI51 BSRI54 BSRI57 BSRI60);
  GID2 = -GID2; GID4 = -GID4; GID5 = -GID5; GID7 = -GID7; GID9 = -GID9;
  GID11 = -GID11; GID13 = -GID13; EgenID = mean(GID1 - GID14);
  Amthread = Amath - Areading; Amtharts = Amath - Aarts;
  Imthread = Imath - Ireading; Imtharts = Imath - Iarts;
  SATperf = SATmath - SATverb;
  if major in (1,2) then majorcat = 1;else if major in (3,4) then majorcat = 2;
  AnmlTmpD = bugtemp - anmltemp; FoodTmpD = fruttemp - foodtemp;

/*overall analysis*/
proc means; var bDbgbdal bdbggdal bdftbdal bdftgdal nDbgbdal ndbggdal ndftbdal ndftgdal;run;
proc glm; model bDbgbdal bdbggdal bdftbdal bdftgdal nDbgbdal ndbggdal ndftbdal ndftgdal = /nouni;
          repeated backgrnd 2, bugfruit 2, badgood 2;run;
proc glm; model bDbgbdal bdbggdal = /nouni; repeated badgood 2;title 'bugs only';run;
proc glm; model nDbgbdal nDbggdal = /nouni; repeated badgood 2;title 'bugs only';run;
proc glm; model bDftbdal bDftgdal = /nouni;repeated badgood 2;title 'fruit only';run;
proc glm; model NDftbdal NDftgdal = /nouni;repeated badgood 2;title 'fruit only';run;

proc glm; model NDbgbd66 NDbggd66 NDftbd66 NDftgd66 NDbgbd83 NDbggd83 NDftbd83 NDftgd83
      BDbgbd66 BDbggd66 BDftbd66 BDftgd66 BDbgbd83 BDbggd83 BDftbd83 BDftgd83 = /nouni;
     repeated backgrnd 2, window 2, bugfruit 2, badgood 2;run;

/*bias analysis*/
proc means; var bbbgbdal bbbggdal bbftbdal bbftgdal nbbgbdal nbbggdal nbftbdal nbftgdal;run;
proc glm; model bbbgbdal bbbggdal bbftbdal bbftgdal nbbgbdal nbbggdal nbftbdal nbftgdal = /nouni;
          repeated backgrnd 2, bugfruit 2, badgood 2;run;
proc glm; model bbbgbdal bbbggdal = /nouni; repeated badgood 2;title 'bugs only';run;
proc glm; model nbbgbdal nbbggdal = /nouni; repeated badgood 2;title 'bugs only';run;
proc glm; model bbftbdal bbftgdal = /nouni;repeated badgood 2;title 'fruit only';run;
proc glm; model Nbftbdal Nbftgdal = /nouni;repeated badgood 2;title 'fruit only';run;

proc glm; model Nbbgbd66 Nbbggd66 Nbftbd66 Nbftgd66 Nbbgbd83 Nbbggd83 Nbftbd83 Nbftgd83
      Bbbgbd66 Bbbggd66 Bbftbd66 Bbftgd66 Bbbgbd83 Bbbggd83 Bbftbd83 Bbftgd83 = /nouni;
     repeated backgrnd 2, window 2, bugfruit 2, badgood 2;run;
proc means;
  var Nbbgbd66 Nbbggd66 Nbftbd66 Nbftgd66 Nbbgbd83 Nbbggd83 Nbftbd83 Nbftgd83
      Bbbgbd66 Bbbggd66 Bbftbd66 Bbftgd66 Bbbgbd83 Bbbggd83 Bbftbd83 Bbftgd83;run;

proc glm; model Nbbgbd66 Nbbggd66 = /nouni;repeated badgood 2;title 'bugs only';run;
proc glm; model Nbbgbd83 Nbbggd83 = /nouni;repeated badgood 2;title 'bugs only';run;
proc glm; model Bbbgbd66 Bbbggd66 = /nouni;repeated badgood 2;title 'bugs only';run;
proc glm; model Bbbgbd83 Bbbggd83 = /nouni;repeated badgood 2;title 'bugs only';run;

proc glm; model Nbftbd66 Nbftgd66 = /nouni;repeated badgood 2;title 'fruit only';run;
proc glm; model Nbftbd83 Nbftgd83 = /nouni;repeated badgood 2;title 'fruit only';run;
proc glm; model Bbftbd66 Bbftgd66 = /nouni;repeated badgood 2;title 'fruit only';run;
proc glm; model Bbftbd83 Bbftgd83 = /nouni;repeated badgood 2;title 'fruit only';run; 

/*sensitivity*/
proc means;
  var NDbgbd66 NDbggd66 NDftbd66 NDftgd66 NDbgbd83 NDbggd83 NDftbd83 NDftgd83
      BDbgbd66 BDbggd66 BDftbd66 BDftgd66 BDbgbd83 BDbggd83 BDftbd83 BDftgd83;run;
proc means;
  class order;
  var NDbgbd66 NDbggd66 NDftbd66 NDftgd66 NDbgbd83 NDbggd83 NDftbd83 NDftgd83
      BDbgbd66 BDbggd66 BDftbd66 BDftgd66 BDbgbd83 BDbggd83 BDftbd83 BDftgd83;run;
proc print;
  var sub NDbgbd66 NDbggd66 NDftbd66 NDftgd66 NDbgbd83 NDbggd83 NDftbd83 NDftgd83
      BDbgbd66 BDbggd66 BDftbd66 BDftgd66 BDbgbd83 BDbggd83 BDftbd83 BDftgd83;run;

proc glm; model NDbgbd66 NDbggd66 NDftbd66 NDftgd66 = order /nouni;repeated bugfruit 2, badgood 2;run;
proc glm; model NDbgbd83 NDbggd83 NDftbd83 NDftgd83 = order /nouni;repeated bugfruit 2, badgood 2;run;
proc glm; model BDbgbd66 BDbggd66 BDftbd66 BDftgd66 = order /nouni;repeated bugfruit 2, badgood 2;run;
proc glm; model BDbgbd83 BDbggd83 BDftbd83 BDftgd83 = order /nouni;repeated bugfruit 2, badgood 2;run;
proc glm; model NDbgbd66 NDbggd66 = /nouni;repeated badgood 2;title 'bugs only';run;
proc glm; model NDbgbd83 NDbggd83 = /nouni;repeated badgood 2;title 'bugs only';run;
proc glm; model BDbgbd66 BDbggd66 = /nouni;repeated badgood 2;title 'bugs only';run;
proc glm; model BDbgbd83 BDbggd83 = /nouni;repeated badgood 2;title 'bugs only';run;
proc glm; model NDftbd66 NDftgd66 = /nouni;repeated badgood 2;title 'fruit only';run;
proc glm; model NDftbd83 NDftgd83 = /nouni;repeated badgood 2;title 'fruit only';run;
proc glm; model BDftbd66 BDftgd66 = /nouni;repeated badgood 2;title 'fruit only';run;
proc glm; model BDftbd83 BDftgd83 = /nouni;repeated badgood 2;title 'fruit only';run;  

/*
proc corr;
  var NBugAt66 NBugAt83 BBugAt66 BBugAt83 NFrtAt66 NFrtAt83 BFrtAt66 BFrtAt83; run;
proc corr;
  var AnmlTmpD bugtemp FoodTmpD fruttemp relfruit relbugs bugfruit;
  with NBugAt66 NBugAt83 BBugAt66 BBugAt83 NFrtAt66 NFrtAt83 BFrtAt66 BFrtAt83;run;*/
